'''
Created on 2011-07-10

@author: Mikael
'''

from PyQt4.QtGui import QFileDialog
from PyQt4.QtGui import QWidget
from View import AppStyleSheet


'''
FileDialog options:
QFileDialog.ShowDirsOnly              Only show directories in the file dialog. By default both files and directories are shown. 
                                      (Valid only in the Directory file mode.)
QFileDialog.DontResolveSymlinks       Don't resolve symlinks in the file dialog. By default symlinks are resolved.
QFileDialog.DontConfirmOverwrite      Don't ask for confirmation if an existing file is selected. By default confirmation is requested.
QFileDialog.DontUseNativeDialog       Don't use the native file dialog. By default, the native file dialog is used unless you use a subclass of QFileDialog that contains the Q_OBJECT macro.
QFileDialog.ReadOnly                  Indicates that the model is readonly.
QFileDialog.HideNameFilterDetails     Indicates if the file name filter details are hidden or not.
QFileDialog.DontUseSheet              previous versions of Qt, the static functions would create a sheet by default if the static function was given a parent. This is no longer supported and does nothing in Qt 4.5, The static functions will always be an application modal dialog. If you want to use sheets, use QFileDialog.open() instead.
'''


class FileSystemExplorer(object):
    
    def __init__(self):
        '''
        '''
        self.mFileDialog = QFileDialog()

    
    def openOneFile(self, parent=None, caption="", filter="", directory="./", options=None):
        
       # self.mFileDialog.setStyleSheet(AppStyleSheet.mStyleSheet)
        if options is None:
            return self.mFileDialog.getOpenFileName(parent, caption, directory, filter)
        
        return self.mFileDialog.getOpenFileName(parent, caption, directory, filter, options)
    
    '''def openFiles(self, parent=QWidget(), caption="", filter="",directory="./", options=0):
    
        return self.mFileDialog.getOpenFileNames(parent, caption, directory, options)
    
    def openDir(self, parent=QWidget(), caption="", filter="", directory="./",options=QFileDialog.ShowDirsOnly):
        return self.mFileDialog.getExistingDirectory(parent, caption, filter, directory, options)'''
        
    def saveFile(self, parent=None, caption="", filter="", directory="./", options=None):
        #self.mFileDialog.setStyleSheet(AppStyleSheet.mStyleSheet)
        if options is None:
            return self.mFileDialog.getSaveFileName(parent, caption, directory, filter)
        
        return self.mFileDialog.getSaveFileName(parent, caption, directory, filter, options)
